module vlib.Lib ;

import vlib.Types ;


extern(C) {
	void exit(int);
	void printf(char*, ... );
}

struct vLib {
	
	static ev_loop_t*	loop;
	static char[]		app , dir ;
	static vDns		dns ;
	static vFcgi		fcgi ;
	
	
	static void Init() {
		_G.Init ;
		vLog.Init ;
		B62.Init ;
		
		WSADATA wd = void;
		WSAStartup (0x0202, &wd);
		loop = ev_loop_new(0);
		dns.Init(loop) ;
		foreach( _ip ; _G.dns_ip ) {
			dns.AddServer( _ip , 53);
		}
		
		TerminateOldProcess ;
		fcgi.Init ;
		vProcess.Init ;
	}
	
	static void Exit(int i) {
		vProcess.StopAll() ;
		exit(i);
	}

	static void Loop(){
		ev_run( loop , 0) ;
	}
	
}
